import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReflectorKnowledgeVO, ReflectorKnowledgeForm, ReflectorKnowledgeQuery } from '@/api/system/reflectorKnowledge/types';

/**
 * 查询反射器知识库信息列表
 * @param query
 * @returns {*}
 */

export const listReflectorKnowledge = (query?: ReflectorKnowledgeQuery): AxiosPromise<ReflectorKnowledgeVO[]> => {
  return request({
    url: '/system/reflectorKnowledge/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询反射器知识库信息详细
 * @param reflectorId
 */
export const getReflectorKnowledge = (reflectorId: string | number): AxiosPromise<ReflectorKnowledgeVO> => {
  return request({
    url: '/system/reflectorKnowledge/' + reflectorId,
    method: 'get'
  });
};

/**
 * 新增反射器知识库信息
 * @param data
 */
export const addReflectorKnowledge = (data: ReflectorKnowledgeForm) => {
  return request({
    url: '/system/reflectorKnowledge',
    method: 'post',
    data: data
  });
};

/**
 * 修改反射器知识库信息
 * @param data
 */
export const updateReflectorKnowledge = (data: ReflectorKnowledgeForm) => {
  return request({
    url: '/system/reflectorKnowledge',
    method: 'put',
    data: data
  });
};

/**
 * 修改反射器知识库信息
 * @param data
 */
export const editReflector = (data: ReflectorKnowledgeForm) => {
  return request({
    url: '/system/reflectorKnowledge/editReflector',
    method: 'put',
    data: data
  });
};

/**
 * 删除反射器知识库信息
 * @param reflectorId
 */
export const delReflectorKnowledge = (reflectorId: string | number | Array<string | number>) => {
  return request({
    url: '/system/reflectorKnowledge/' + reflectorId,
    method: 'delete'
  });
};
